<template>
{{#if ctrl.psSysPFPlugin}}
    {{> @macro/plugins/widget/widget-use.hbs appPlugin=ctrl.psSysPFPlugin}}
{{else}}
    <div :class="classNames">
        <AppDrtab :counterData="store.counterData" :pages="store.pages" :selectItem="store.selectItem" :viewType="viewType" :caption="model.caption" :capPSLanguageRes="model.capPSLanguageRes" :iconClass="model.iconClass" :imgPath="model.imgPath" :codeName="model.codeName" @itemClick="(item:any) => { handleSelectChange(item) }">
        </AppDrtab>
    </div>
{{/if}}
</template>
<script setup lang="ts">
// 基于template/src/widgets/\{{appEntities}}/\{{ctrls@DRTAB}}-drtab/\{{spinalCase ctrl.codeName}}-drtab.vue.hbs生成
{{> @macro/plugins/widget/widget-import.hbs ctrl=ctrl}}
import { AppDrtab } from "@components/widgets/drtab";
import { model } from "./{{spinalCase ctrl.codeName}}-drtab-model";
import { IContext, IParam, DrtabActionType, IDrtabAbility, IDrtabControllerParams, IDrtabStore, DrtabController, IDrtabController, ICtrlDataAction, ILoadingHelper, createUUID, IViewCtx } from "@/core";
import { getCtrlClassNames, useEventBind, useNavParamsBind } from "@/hooks/use-ctrl";

{{> @macro/widgets/ctrl/ctrl-props.hbs
    props="openView?: Function;
    newView?: Function;
    actions?: ICtrlDataAction;
    viewType: string;
    "
}}

{{> @macro/common/emit.hbs name="ctrl" actionType="DrtabActionType" ability="IDrtabAbility"}}

//  部件样式名
const classNames = computed(() => {
    return getCtrlClassNames(model, props);
});
const controlID = 'id' + createUUID();
const params: IDrtabControllerParams<DrtabActionType, IDrtabAbility> = {
    name: props.name,
    model,
    evt,
    controlID,
    actions: props.actions,
    viewType: props.viewType,
    openView: props.openView,
    newView: props.newView,
    closeView: props.closeView,
    pViewCtx: props.pViewCtx,
    pLoadingHelper: props.pLoadingHelper,
    handler: (data: IDrtabStore) => { return reactive(data); }
};
{{> @macro/common/controller.hbs name="ctrl" IController="IDrtabController" store="IDrtabStore" ability="IDrtabAbility" controller="DrtabController"}}

const handleSelectChange = (item: IParam) => {
  controller.handleSelectChange(item);
}
</script>
